package edu.scnu.fans.fingertip.order.input;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

@ApiModel("创建订单")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CreateOrderInput {

    @ApiModelProperty("商品id")
    @NotNull(message = "不能为空")
    private Long itemId;

    @ApiModelProperty("商品规格列表")
    @NotNull(message = "不能为空")
    @Size(min = 1, max = 200, message = "数量在1~200之间")
    private List<CreateOrderSpecInput> specList;

    @ApiModelProperty("收货地址id")
    @NotNull(message = "不能为空")
    private Long addressId;

    @ApiModelProperty("订单备注（选填）")
    @Size(min = 1, max = 200, message = "数量在1~200之间")
    private String remark;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @ApiModel("商品规格")
    public static class CreateOrderSpecInput {
        private Long specId;

        private Integer amount;
    }

}
